<%@ page import="dao.CollegeDao" %>
<%@ page import="entity.College" %>
<%@ page import="java.util.List" %>
<%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2024/10/29
  Time: 19:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学院信息管理</title>
</head>
<body>
      <h1>学院信息</h1>
        <a href="college_add.jsp" >+新增学院</a>

      <table>
          <thead>
            <th>id</th>  <th>名称</th>   <th>操作</th>
          </thead>
          <body>
            <%
               /*通过java数据库访问代码，从现有学院信息表tb_collge中
               * 读取所有学院记录，遍历记录，生成 tr标签
               * */
                CollegeDao dao =  new CollegeDao();
                List<College> list  =  dao.getAll();
                for(College obj :list){
                    out.println("<tr>");
                        out.println("<td>"+obj.getId()+"</td>");
                        out.println("<td>"+obj.getName()+"</td>");
                        out.println("<td>"
                                    +"<a>修改</a>"
                                    +"<a href=\"college_del.jsp?id="+obj.getId()+"\"  onclick=\" return confirm('您确定要删除吗?')  \"   >删除</a>"
                                    +"</td>");
                    out.println("</tr>");
                }
            %>
          </body>

      </table>

</body>
</html>
